﻿@{
    ViewBag.Title = "Home Page";
}
@model IEnumerable<FantasyBlog.DAL.Post>
@section Header
{
    <link rel=Stylesheet type="text/css" href="@Url.Content("~/Content/themes/base/navi-page.css")" meida="all"/>
}
<div class="content-body">
    @if (ViewBag.info != null)
    {
        <header class="page-header">
            <h1 class="page-title" style="text-transform: none">@ViewBag.info</h1>
        </header>
    }
    @foreach (var post in Model)
    {
        <article id="post" class="post-12 post type-post status-publish format-standard hentry category-1">
            <header class="entry-header">
                <h1 class="entry-title">
                    @Html.ActionLink(post.title, "Details", new { id = post.ID })
                </h1>
                <div class="entry-meta">
                    <span class="sep">发表于 </span>
                    <time class="entry-date" datetime="@post.date">@post.date.ToString("yyyy-MM-dd")
                    </time>
                    <span class="by-author"><span class="sep">由 </span><span class="author vcard"><a class="url fn n" href="/Post/Author/@post.PostUser.username" title="查看所有由 @post.PostUser.username.Trim() 发布的文章" rel="author">
                        @post.PostUser.username.Trim()
                    </a></span></span>
                </div>
                <!-- .entry-meta -->
                <div class="comments-link">
                    <a href="/Post/Index/@post.ID#respond" title="《@post.title》上的评论"><span class="leave-reply">
                        回复</span></a>
                </div>
            </header>
            <!-- .entry-header -->
            <div class="entry-content">
                <p>@post.content</p>
            </div>
            <!-- .entry-content -->
            <footer class="entry-meta">
                <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links">
                    发表在 </span><a href="@Url.Content("~/Post/Category/" + post.Category.name)" title="查看 @post.Category.name 中的全部文章" rel="category tag">@post.Category.name</a>
                </span>
                <span class="sep">| </span>
               @if (post.Terms.Count > 0)
               {
                <span class="tag-links">
                <span class="entry-utility-prep entry-utility-prep-tag-links">标签有</span>
                @foreach (var t in @post.Terms)
                {
                    <a href="/Post/Tag/@t.name" rel="tag">@t.name </a>
                }
                </span>
                <span class="sep">| </span>
               }
                <span class="comments-link"><a href="@Url.Content("~/Post/Details/" + post.ID.ToString() + "#respond")" title="《@post.title》上的评论">
                    <span class="leave-reply">
                        @{
                            var count = @post.Comments.AsQueryable().FilterOpenedComments().Count();
                            if (count > 0)
                            {
                                @count @:条回复
                            
                            }
                            else
                            {
                            @:发表回复
                            }
                        }
                    </span></a></span><span class="edit-link"><a class="post-edit-link" href="http://ggtwlb0314.gicp.net/blog/wp-admin/post.php?post=12&amp;action=edit"
                        title="编辑文章">编辑</a></span>
            </footer>
            <!-- #entry-meta -->
        </article>
    }
</div>
<div class="pagenavi">
    <span class="pages">第 @ViewBag.currentPage 页，共 @(ViewBag.total)
        页</span>
    @for (int i = 1; i <= ViewBag.total; i++)
    {
        if (i == ViewBag.currentPage)
        {
        <span class="current">@i</span>
        }
        else
        {
        <a href="" class="page larger">@i</a>
        }
    }
</div>
